package com.mall.shopping.converter;

import com.mall.shopping.dal.entitys.Item;
import com.mall.shopping.dto.ProductDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring")
public interface ProductListByPageConverter {
    @Mappings({@Mapping(source = "sellPoint", target = "subTitle"),
            @Mapping(source = "id", target = "productId"),
            @Mapping(source = "title", target = "productName"),
            @Mapping(source = "price", target = "salePrice"),
            @Mapping(source = "image", target = "picUrl")}
    )
    ProductDto item2Dto(Item item);

    List<ProductDto> item2Dtos(List<Item> items);
}
